﻿/***
* 初始化分页封装
* pagination: 分页对象
* onPageChangeCallback: 页面跳转回调函数
* dependence $jQuery $layUi $layPage
***/
function paginationInit(pagination, onPageChangeCallback) {
    var setting = {
        cont: 'pagination',
        pages: pagination.TotalPages,
        curr: pagination.Page,
        jump: function () {
            // 使第一页加载的时候不执行回调函数
            if (this.curr == setting.curr) return;
            setting.curr = this.curr;
            if (typeof (onPageChangeCallback) === "function") onPageChangeCallback(this);
        }
    };

    layui.laypage($.extend({}, setting));
}
/***
* Vue拓展
***/
Vue = Vue.extend({
    data: function () {
        return {
            datas: {
                Datas: [],
                Filter: {}
            }
        };
    },
    methods: {
        query: function (layPage) {
            var that = this;
            var arg = $.extend({}, this.datas.Filter, { page: layPage ? layPage.curr : 1 });
            $.post("", arg).success(function (json) {
                that.datas = json;
            });
        }
    }
});